package org.example.hospital_frontend.exception;

import org.example.hospital_frontend.common.ErrorCode;

/**
 * 自定义异常类
 */
public class BusinessException extends RuntimeException{
    private final int code;

    public BusinessException(int code,String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(ErrorCode errorCode){
        super(errorCode.getMsg());
        this.code = errorCode.getCode();
    }
    public BusinessException(ErrorCode errorCode,String msg){
        super(msg);
        this.code = errorCode.getCode();
    }


    public int getCode() {
        return code;
    }
}
